﻿@{
    ViewData["Title"] = "用户管理";
}

<div class="panel panel-default">
    <div class="form-content">
        <div class="form-body">
            <div id="filter" class="row" data-toggle="form" data-field="User" data-grid="#grid" data-filterable="true">
                <input data-field="Name,UserName,Alice" data-size="4,0,12" data-logic="or" data-operator="contains" />
                <button data-button="query">查询</button>
                <button data-button="clear">清除条件</button>
                <div class="pull-right" style="padding-right:15px;">
                    <button data-button="add" data-popup="UserEdit">新 增</button>
                </div>
            </div>
            <div id="grid" data-toggle="grid" data-form="#filter" node="grid" data-related='#_PopupUserDetail'>
                <div node="columns" node-type="array">
                    <span data-field="HeadImage" data-title="头像照片" data-template="#:data=>$.com.imageThumbFormatter(data.HeadImage, '头像照片')"></span>
                    <span data-field="UserName" data-title="用户名"></span>
                    <span data-field="Name" data-title="姓名"></span>
                    <span data-field="Alias" data-title="称呼"></span>
                    <span data-field="Level" data-title="用户级别"></span>
                    <span data-field="Description" data-title="备注说明"></span>
                    <span data-field="CreatedOn" data-title="创建时间" data-type="date"></span>
                </div>
                <span node="dataSource" data-type="json">
                    <span node="transport">
                        <span node="read" data-url="/api/Users">
                        </span>
                    </span>
                </span>
            </div>
        </div>
    </div>
</div>

<div id="_PopupUserDetail" data-toggle="popup" data-type="UserDetail" data-title="用户信息">
    <div class="popup-content" data-toggle="form" data-field="User" data-detailable="true" data-size="12,4,8">
        <div class="popup-body">
            <div class="form-content">
                <div class="form-body">
                    <div class="col-md-6">
                        <span data-field="Id" data-label="编号" data-display="false"></span>
                        <span data-field="Name" data-label="姓名"></span>
                        <span data-field="Alias" data-label="称呼"></span>
                        <span data-field="UserName" data-label="用户名"></span>
                        <span data-field="Level" data-label="用户级别"></span>
                        <span data-field="Description" data-label="备注说明"></span>
                    </div>
                    <div class="col-md-6">
                        <img data-field="HeadImage" data-label="头像照片" data-layout="vertical" data-size="11,0,12" data-single="true" data-business-type="User.HeadImage" style="max-height:360px;max-width:360px" />
                    </div>
                </div>
            </div>
        </div>
        <div class="popup-footer text-right">
            <button data-button="edit" data-popup="UserEdit">编 辑</button>
            <button data-button="close">关 闭</button>
        </div>
    </div>
</div>

<div id="_PopupUserEdit" data-toggle="popup" data-type="UserEdit" data-title="用户信息" data-related="#filter">
    <div class="popup-content" data-toggle="form" data-field="User" data-editable="true" data-url="/api/Users" data-size="12,4,8">
        <div class="popup-body">
            <div class="form-content">
                <div class="form-body">
                    <div class="col-md-6">
                        <input data-field="Id" data-label="编号" data-display="false" />
                        <input data-field="Name" data-label="姓名" required />
                        <input data-field="Alias" data-label="称呼" />
                        <input data-field="UserName" data-label="用户名" required />
                        <input data-field="Level" data-label="用户级别" data-size="12,4,4" data-role="kendoNumericTextBox" data-min="0" data-max="10" data-value="0" data-format="d" required />
                        <textarea data-field="Description" data-label="备注" rows="3"></textarea>
                    </div>
                    <div class="col-md-6">
                        <input data-field="HeadImage" data-label="头像照片" data-layout="vertical" data-size="10,12,12" data-with-attachments="true" data-business-type="User.HeadImage" data-single="true" type="file" data-role="kendoUpload" data-file-size="4096" data-file-extension=".jpg,.jpeg,.png" />
                    </div>
                </div>
            </div>
        </div>
        <div class="popup-footer text-right">
            <button data-button="post" data-success-text="新增成功">新 增</button>
            <button data-button="put" data-success-text="保存成功">提 交</button>
            <button data-button="delete" data-success-text="删除成功">删 除</button>
            <button data-button="close">关 闭</button>
        </div>
    </div>
</div>

<partial name="../Template/_Attachment" />